OLE ShowSave method of CommonDialog not working

Hi all,
I am trying to use the ShowSave method of an OLE CommonDialog in a DXL script, but I get the following error:
 

Problem with OLE Argument names

 


Everything works correctly with the similar ShowOpen method.
This is my code:

 

 

 

string selectFile(bool saveFile)
  {
  string dbMethod;
  string initDir = "C:/";
  int flags;
  int intAns;
  string retV;
 
  if (saveFile)
    {
    dbMethod = "ShowSave";
    flags = 0x80000 | 0x00002;
    }
  else
    {
    dbMethod = "ShowOpen";
    flags = 0x80000 | 0x01000 | 0x00800;
    }
  
  OleAutoObj objCD = oleCreateAutoObject("userAccounts.CommonDialog");
  retV = olePut(objCD, "filter", "Session files|*.*");
  if (retV != "") { infoBox("Set filter failed"); return (""); }
  retV = olePut(objCD, "InitialDir", initDir);
  if (retV != "") { infoBox("Set Init dir failed"); return (""); }
  retV = olePut(objCD, "Flags", flags);
  if (retV != "") { infoBox("Set flags failed"); return (""); }
 
  // Here comes the problem...
  retV = oleMethod (objCD, dbMethod, null, intAns);
  if (retV != "") { infoBox(dbMethod " failed: " retV); return (""); }
  if (intAns == 1)
    {
    retV = oleGet(objCD, "Filename", retV);
    if (retV != "") { infoBox("oleGet failed"); return (""); }
    return (retV);
    }
  return ("");
  }


Does anyone have any idea?
Is it possible that this method is not available on my machine? How can I find it?
I am using DOORS 8.3.0.1.

N.

 

 


SystemAdmin - Wed Mar 20 06:15:17 EDT 2013

Re: OLE ShowSave method of CommonDialog not working
SystemAdmin - Wed Mar 20 06:43:02 EDT 2013

Update: the code

retV = oleGet(objCD, "Filename", retV);
if (retV != "") { infoBox("oleGet failed"); return (""); }
return (retV);


was wrong and should be obviously replaced by something like this...

 

string fName;
retV = oleGet(objCD, "Filename", fName);
if (retV != "") { infoBox("oleGet failed"); return (""); }
return (fName);


But this does not solve my initial problem.

 

Re: OLE ShowSave method of CommonDialog not working
SystemAdmin - Wed Mar 20 14:36:37 EDT 2013

Hi

First point is: You must not use null, if you have no parameters.

->
replace
 

retV = oleMethod (objCD, dbMethod, null, intAns);

 


by

 

 

retV = oleMethod (objCD, dbMethod, intAns);



The next point: It may be possible that oleMethod is wrong and oleGet is correct.



 

Re: OLE ShowSave method of CommonDialog not working
SystemAdmin - Thu Mar 21 13:08:33 EDT 2013

SystemAdmin - Wed Mar 20 14:36:37 EDT 2013

Hi

First point is: You must not use null, if you have no parameters.

->
replace
 

retV = oleMethod (objCD, dbMethod, null, intAns);

 


by

 

 

retV = oleMethod (objCD, dbMethod, intAns);



The next point: It may be possible that oleMethod is wrong and oleGet is correct.



 

Hi Wolfgang,
Thanks for the answer.
I tried your suggestion, but I get the error

-E- DXL: <addins/MyDOORS/Myfunc.dxl:62> incorrect arguments for function (oleMethod)

It seems that the oleMethod needs exactly 4 arguments...

Also, the same function runs correctly when the method name is "ShowOpen", even if the 3rd argument is null...

N.

Re: OLE ShowSave method of CommonDialog not working
SystemAdmin - Sat Mar 23 07:53:42 EDT 2013

SystemAdmin - Thu Mar 21 13:08:33 EDT 2013
Hi Wolfgang,
Thanks for the answer.
I tried your suggestion, but I get the error

-E- DXL: <addins/MyDOORS/Myfunc.dxl:62> incorrect arguments for function (oleMethod)

It seems that the oleMethod needs exactly 4 arguments...

Also, the same function runs correctly when the method name is "ShowOpen", even if the 3rd argument is null...

N.

Hello
 

OleAutoObj objCD = oleCreateAutoObject("userAccounts.CommonDialog");

 


The problem is: This dialog cannot be activiated by using an object delivered by microsoft. "userAccounts.CommonDialog" is the name of an own implementation, isn't it?

If you use the dialog in VBA-Excel for example you have to call the "GetOpenFilename"-Method of an Excel.Application object. So I think you have problems to understand your own userAccounts-obejct?

Best regards
Wolfgang